package com.woniuxy.light_smart.service.imp;

import com.woniuxy.light_smart.mapper.PermissionMapper;
import com.woniuxy.light_smart.service.MenuServer;
import com.woniuxy.light_smart.vo.MenuVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MenuServerImpl implements MenuServer {
    @Resource
    private PermissionMapper permissionMapper;
    @Override
    public List<MenuVo> selectByTelOrMail(String tel, Integer pid) {
        List<MenuVo> menuVos = permissionMapper.selectByTelOrMail(tel, pid);
        if (menuVos != null) {
            for (MenuVo menuVo : menuVos) {
                List<MenuVo> menuVos1 = selectByTelOrMail(tel, menuVo.getPerId());
                menuVo.setChildren(menuVos1);
            }
        }
        return menuVos;
    }
}
